#include "time.h"



m_time gettime()
{
    m_time retval;
#ifdef __APPLE__
    time_t currentTime = time(nullptr);
    struct tm* localTime = localtime(&currentTime);
    retval.year = localTime->tm_year + 1900;
    retval.month = localTime->tm_mon + 1;
    retval.date = localTime->tm_mday;
    retval.dayofweek = localTime->tm_wday;
    retval.hour = localTime->tm_hour;
    retval.minute = localTime->tm_min;
    retval.sec = localTime->tm_sec;
#elif defined(__linux__)
    time_t currentTime = time(nullptr);
    struct tm* localTime = localtime(&currentTime);
    retval.year = localTime->tm_year + 1900;
    retval.month = localTime->tm_mon + 1;
    retval.date = localTime->tm_mday;
    retval.dayofweek = localTime->tm_wday;
    retval.hour = localTime->tm_hour;
    retval.minute = localTime->tm_min;
    retval.sec = localTime->tm_sec;
#else
    SYSTEMTIME systemTime;
    GetLocalTime(&systemTime);
    retval.year = systemTime.wYear;
    retval.month = systemTime.wMonth;
    retval.date = systemTime.wDay;
    retval.dayofweek = systemTime.wDayOfWeek;
    retval.hour = systemTime.wHour;
    retval.minute = systemTime.wMinute;
    retval.sec = systemTime.wSecond;
#endif
    return retval;
}